<template>
  <div class="contract-compliance">
    <div class="markdown-body markdown-content" v-html="renderedContent"></div>
    <!-- {{ complianceData.contractData }} -->
  </div>
</template>

<script setup>
import { marked } from "marked";
import { computed } from "vue";
import "github-markdown-css/github-markdown.css";

const props = defineProps({
  complianceData: {
    type: Object,
    required: true,
  },
});

const markdownContent = computed(() => {
  return props.complianceData.contractData;
});

const renderedContent = computed(() => {
  return marked(markdownContent.value);
});
</script>

<style lang="scss" scoped>
.contract-compliance {
  padding: 0 20px;

  .markdown-content {
    :deep(h1) {
      font-size: 24px;
      font-weight: bold;
      margin-bottom: 20px;
      color: #111827;
    }

    :deep(h2) {
      font-size: 20px;
      font-weight: 500;
      margin: 16px 0;
      color: #111827;
    }

    :deep(ul) {
      list-style: disc;
      padding-left: 20px;
      margin: 12px 0;
    }

    :deep(li) {
      margin: 8px 0;
      color: #374151;
    }

    :deep(p) {
      margin: 12px 0;
      line-height: 1.6;
      color: #374151;
    }
  }

  .compliance-header {
    margin-bottom: 20px;

    .number {
      font-size: 14px;
      color: #666;
      margin-bottom: 8px;
    }

    .title {
      font-size: 18px;
      font-weight: 500;
      color: #111827;
    }
  }

  .asset-name {
    font-size: 16px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 24px;
  }

  .file-section {
    display: flex;
    gap: 40px;
    margin-bottom: 32px;

    .file-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;

      .label {
        font-size: 14px;
        color: #666;
      }

      .file-icon {
        width: 60px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f3f4f6;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.3s;

        &:hover {
          background: #e5e7eb;
        }

        .el-icon {
          font-size: 24px;
          color: #666;
        }
      }
    }
  }

  .list-section {
    .section-title {
      font-size: 16px;
      font-weight: 500;
      color: #111827;
      margin-bottom: 16px;
    }
  }
}
</style>
